//
//  BKOneViewCell.m
//  FastBee
//
//  Created by mac on 16/9/10.
//  Copyright © 2016年 xbk. All rights reserved.
//

#import "BKOneViewCell.h"
#import "UIView+MDRExtension.h"
#import "UIImageView+WebCache.h"

@interface BKOneViewCell()
@property (nonatomic,weak) UIImageView *pictureView;

@end

@implementation BKOneViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupUI];
    }
    return self;
}


- (void)setModel:(BKOneModel *)model{

    _model = model;
    [self.pictureView sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:nil];
}


- (void)setupUI{
    
    CGFloat margin = 12;
    CGFloat itemWidth = [UIScreen mainScreen].bounds.size.width - 2*margin;;
    CGFloat itemHeight = 130;
    
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(margin, 0, itemWidth, itemHeight)];
    [self.contentView addSubview:imageView];
    
    imageView.backgroundColor = [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0];
    _pictureView = imageView;
}


@end
